import os

def get_config_path():
    file_dir = os.path.dirname(__file__)
    return os.path.dirname(file_dir) + '/datas'

def get_index_codes():
    return [
        '000300.SH',
        '000905.SH',
        '399006.SZ', #创业板
        '000852.SH', #中证1000
        '399324.SZ', #深证红利
        '000922.SH', #中证红利
        '399997.SZ', #中证白酒
        '399396.SZ', #食品饮料

        '000013.SH',#上证企债
        '000016.SH' #上证50
    ]

def get_global_index_codes():
    return {
        'HSI':'恒生指数',
        'SPX':'标准普尔500指数',
        'IXIC':'纳斯达克指数',
        'GDAXI':'德国DAX指数',
        'N225':'日经225指数',
    }

class GlobalEvent:
    MSG_TYPE_SERIES = 1
    TASK_CHANGED = 2
    GRAPH_RESULT = 3
    MESSAGE = 5

    BKT_START = 10
    BKT_FINISHED = 11
    BKT_PROGRESS = 12

    def __init__(self):
        self.observers = []

    def add_observer(self,observer):
        self.observers.append(observer)

    def notify(self, event_type, data):
        for o in self.observers:
            data.update({'event_type': event_type})


G = GlobalEvent()

from engine.data.expr.expr_mgr import ExprMgr
from common.taskmgr import TaskMgr
E = ExprMgr()
E.init()
T = TaskMgr()
